import React from "react";
import ThemeContext from "../../ThemeContext";

/*
*  方式一：基于<ThemeContext.Consumer> 组件 获取 上下文信息
* */
const VoteMain = function VoteMain(props, context) {
    console.log(props, context, 111)
    return <ThemeContext.Consumer>
        {context => {
            let {supNum,oppNum} = context
            return <div className="main">
                <p>支持人数：{supNum}人</p>
                <p>反对人数：{oppNum}人</p>
            </div>
        }}
    </ThemeContext.Consumer>;
};
VoteMain.contextType = ThemeContext
export default VoteMain;